﻿
namespace ATA.Windows.Forms
{
	/// <summary>
	/// This is the abstract edit form for the <see cref="Entities.ChuongTrinhChiTiet"/> entity.
	/// </summary>
	/// <remarks>This class is overwritten by .netTiers at each generation.</remarks>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class ChuongTrinhChiTietEditControlBase : System.Windows.Forms.UserControl
	{
		#region Fields
		
		//private System.Windows.Forms.TableLayoutPanel uxTableLayoutPanel;
		/// <summary>
		/// The ErrorProvider for the Entity;
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxErrorProvider;
		
		/// <summary>
		/// The BindingSource for the entity.
		///</summary>
		protected System.Windows.Forms.BindingSource uxBindingSource;
						
		
		/// <summary>
		/// TextBox for the ChiTietId property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxChiTietId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ChiTietId property.
		/// </summary>
		protected System.Windows.Forms.Label uxChiTietIdLabel;
		
		/// <summary>
		/// ComboBox for the LoaiThoiGianId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxLoaiThoiGianId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LoaiThoiGianId property.
		/// </summary>
		protected System.Windows.Forms.Label uxLoaiThoiGianIdLabel;
		
		/// <summary>
		/// TextBox for the SoThoiGian property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxSoThoiGian;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the SoThoiGian property.
		/// </summary>
		protected System.Windows.Forms.Label uxSoThoiGianLabel;
		
		/// <summary>
		/// TextBox for the DoanhSo property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxDoanhSo;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the DoanhSo property.
		/// </summary>
		protected System.Windows.Forms.Label uxDoanhSoLabel;
		
		/// <summary>
		/// ComboBox for the ChuongTrinhId property.
		/// </summary>
		protected System.Windows.Forms.ComboBox uxChuongTrinhId;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the ChuongTrinhId property.
		/// </summary>
		protected System.Windows.Forms.Label uxChuongTrinhIdLabel;
		
		/// <summary>
		/// DataTimePicker for the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.DateTimePicker uxLastUpdate;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the LastUpdate property.
		/// </summary>
		protected System.Windows.Forms.Label uxLastUpdateLabel;
		
		/// <summary>
		/// TextBox for the UpdateBy property. 
		/// </summary>
		protected System.Windows.Forms.TextBox uxUpdateBy;
		
		/// <summary>
		/// The <see cref="System.Windows.Forms.Label"/> associated with the UpdateBy property.
		/// </summary>
		protected System.Windows.Forms.Label uxUpdateByLabel;
		#endregion
		
		#region Main entity
		private Entities.ChuongTrinhChiTiet _ChuongTrinhChiTiet;
		/// <summary>
		/// Gets or sets the <see cref="Entities.ChuongTrinhChiTiet"/> entity to edit with this form.
		/// </summary>
		/// <value>The <see cref="Entities.ChuongTrinhChiTiet"/> instance.</value>
		public Entities.ChuongTrinhChiTiet ChuongTrinhChiTiet
		{
			get {return this._ChuongTrinhChiTiet;}
			set
			{
				this._ChuongTrinhChiTiet = value;
				if (value != null) 
				{
					this.uxBindingSource.DataSource = value;
					BindControls();
				}			
				
			}
		}
		#endregion
		
		/// <summary>
		/// Binds the controls.
		/// </summary>
		private void BindControls()
		{
			this.uxChiTietId.DataBindings.Clear();
			this.uxChiTietId.DataBindings.Add("Text", this.uxBindingSource, "ChiTietId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLoaiThoiGianId.DataBindings.Clear();
			this.uxLoaiThoiGianId.DataBindings.Add("SelectedValue", this.uxBindingSource, "LoaiThoiGianId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxSoThoiGian.DataBindings.Clear();
			this.uxSoThoiGian.DataBindings.Add("Text", this.uxBindingSource, "SoThoiGian", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxDoanhSo.DataBindings.Clear();
			this.uxDoanhSo.DataBindings.Add("Text", this.uxBindingSource, "DoanhSo", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxChuongTrinhId.DataBindings.Clear();
			this.uxChuongTrinhId.DataBindings.Add("SelectedValue", this.uxBindingSource, "ChuongTrinhId", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxLastUpdate.DataBindings.Clear();
			this.uxLastUpdate.DataBindings.Add("Value", this.uxBindingSource, "LastUpdate", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
			this.uxUpdateBy.DataBindings.Clear();
			this.uxUpdateBy.DataBindings.Add("Text", this.uxBindingSource, "UpdateBy", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
		}					
		
		#region Constructor
		
		/// <summary>
		/// Initializes a new instance of the <see cref="ChuongTrinhChiTietEditControlBase"/> class.
		/// </summary>
		public ChuongTrinhChiTietEditControlBase()
		{
			InitializeComponent();			
			
			this.uxBindingSource.CurrentItemChanged += new System.EventHandler(uxBindingSource_currentItemChanged);
		}		
		
		/// <summary>
		/// 
		/// </summary>
		private void uxBindingSource_currentItemChanged(object sender, System.EventArgs e)
		{
			if (_ChuongTrinhChiTiet != null) _ChuongTrinhChiTiet.Validate();
		}	
				
		/// <summary>
		/// Initializes the component.
		/// </summary>
		public void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.uxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxBindingSource = new System.Windows.Forms.BindingSource(this.components);
			
			//this.uxTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
			this.uxChiTietId = new System.Windows.Forms.TextBox();
			uxChiTietIdLabel = new System.Windows.Forms.Label();
			this.uxLoaiThoiGianId = new System.Windows.Forms.ComboBox();
			uxLoaiThoiGianIdLabel = new System.Windows.Forms.Label();
			this.uxSoThoiGian = new System.Windows.Forms.TextBox();
			uxSoThoiGianLabel = new System.Windows.Forms.Label();
			this.uxDoanhSo = new System.Windows.Forms.TextBox();
			uxDoanhSoLabel = new System.Windows.Forms.Label();
			this.uxChuongTrinhId = new System.Windows.Forms.ComboBox();
			uxChuongTrinhIdLabel = new System.Windows.Forms.Label();
			this.uxLastUpdate = new System.Windows.Forms.DateTimePicker();
			uxLastUpdateLabel = new System.Windows.Forms.Label();
			this.uxUpdateBy = new System.Windows.Forms.TextBox();
			uxUpdateByLabel = new System.Windows.Forms.Label();
			
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).BeginInit();
			this.SuspendLayout();
			
			// 
			// uxTableLayoutPanel
			// 
			//this.uxTableLayoutPanel.AutoSize = true;
			//this.uxTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
			//this.uxTableLayoutPanel.ColumnCount = 2;
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 120F));
			//this.uxTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 250F));
			//this.uxTableLayoutPanel.Location = new System.Drawing.System.Drawing.Point(3, 3);
			//this.uxTableLayoutPanel.Name = "uxTableLayoutPanel";
			//this.uxTableLayoutPanel.RowCount = 2;
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F));
			//this.uxTableLayoutPanel.Size = new System.Drawing.Size(450, 50);
			//this.uxTableLayoutPanel.TabIndex = 0;
			
			//
			// uxErrorProvider
			//
			this.uxErrorProvider.ContainerControl = this;
			this.uxErrorProvider.DataSource = this.uxBindingSource;
			
			//
			// uxChiTietIdLabel
			//
			this.uxChiTietIdLabel.Text = "ChiTietId:";
			this.uxChiTietIdLabel.Location = new System.Drawing.Point(3, 0);
			this.Controls.Add(this.uxChiTietIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxChiTietIdLabel);			
			//
			// uxChiTietId
			//
			this.uxChiTietId.ReadOnly = true;
			//this.uxTableLayoutPanel.Controls.Add(this.uxChiTietId);
			this.uxChiTietId.Location = new System.Drawing.Point(160, 0);
			this.Controls.Add(this.uxChiTietId);
			//
			// uxLoaiThoiGianIdLabel
			//
			this.uxLoaiThoiGianIdLabel.Text = "LoaiThoiGianId:";
			this.uxLoaiThoiGianIdLabel.Location = new System.Drawing.Point(3, 26);
			this.Controls.Add(this.uxLoaiThoiGianIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLoaiThoiGianIdLabel);			
			//
			// uxLoaiThoiGianId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxLoaiThoiGianId);
			this.uxLoaiThoiGianId.Location = new System.Drawing.Point(160, 26);
			this.Controls.Add(this.uxLoaiThoiGianId);
			//
			// uxSoThoiGianLabel
			//
			this.uxSoThoiGianLabel.Text = "SoThoiGian:";
			this.uxSoThoiGianLabel.Location = new System.Drawing.Point(3, 52);
			this.Controls.Add(this.uxSoThoiGianLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxSoThoiGianLabel);			
			//
			// uxSoThoiGian
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxSoThoiGian);
			this.uxSoThoiGian.Location = new System.Drawing.Point(160, 52);
			this.Controls.Add(this.uxSoThoiGian);
			//
			// uxDoanhSoLabel
			//
			this.uxDoanhSoLabel.Text = "DoanhSo:";
			this.uxDoanhSoLabel.Location = new System.Drawing.Point(3, 78);
			this.Controls.Add(this.uxDoanhSoLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxDoanhSoLabel);			
			//
			// uxDoanhSo
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxDoanhSo);
			this.uxDoanhSo.Location = new System.Drawing.Point(160, 78);
			this.Controls.Add(this.uxDoanhSo);
			//
			// uxChuongTrinhIdLabel
			//
			this.uxChuongTrinhIdLabel.Text = "ChuongTrinhId:";
			this.uxChuongTrinhIdLabel.Location = new System.Drawing.Point(3, 104);
			this.Controls.Add(this.uxChuongTrinhIdLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxChuongTrinhIdLabel);			
			//
			// uxChuongTrinhId
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxChuongTrinhId);
			this.uxChuongTrinhId.Location = new System.Drawing.Point(160, 104);
			this.Controls.Add(this.uxChuongTrinhId);
			//
			// uxLastUpdateLabel
			//
			this.uxLastUpdateLabel.Text = "LastUpdate:";
			this.uxLastUpdateLabel.Location = new System.Drawing.Point(3, 130);
			this.Controls.Add(this.uxLastUpdateLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdateLabel);			
			//
			// uxLastUpdate
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxLastUpdate);
			this.uxLastUpdate.Location = new System.Drawing.Point(160, 130);
			this.Controls.Add(this.uxLastUpdate);
			//
			// uxUpdateByLabel
			//
			this.uxUpdateByLabel.Text = "UpdateBy:";
			this.uxUpdateByLabel.Location = new System.Drawing.Point(3, 156);
			this.Controls.Add(this.uxUpdateByLabel);
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateByLabel);			
			//
			// uxUpdateBy
			//
			//this.uxTableLayoutPanel.Controls.Add(this.uxUpdateBy);
			this.uxUpdateBy.Location = new System.Drawing.Point(160, 156);
			this.Controls.Add(this.uxUpdateBy);
			//
			// uxChuongTrinhId
			//				
			this.uxChuongTrinhId.DisplayMember = "TenChuongTrinh";	
			this.uxChuongTrinhId.ValueMember = "ChuongTrinhId";	
			//
			// uxLoaiThoiGianId
			//				
			this.uxLoaiThoiGianId.DisplayMember = "TenLoaiThoiGian";	
			this.uxLoaiThoiGianId.ValueMember = "LoaiThoiGianId";	
			// 
			// ChuongTrinhChiTietEditControlBase
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			//this.Controls.Add(this.uxTableLayoutPanel);
			this.AutoScroll = true;
			this.Name = "ChuongTrinhChiTietEditControlBase";
			this.Size = new System.Drawing.Size(478, 311);
			//this.Localizable = true;
			((System.ComponentModel.ISupportInitialize)(this.uxErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBindingSource)).EndInit();			
			this.ResumeLayout(false);
			this.PerformLayout();
		}
		#endregion
				
		#region ComboBox List
		
				
		private Entities.TList<Entities.ChuongTrinh> _ChuongTrinhIdList;
		
		/// <summary>
		/// The ComboBox associated with the ChuongTrinhId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.ChuongTrinh> ChuongTrinhIdList
		{
			get {return _ChuongTrinhIdList;}
			set 
			{
				this._ChuongTrinhIdList = value;
				this.uxChuongTrinhId.DataSource = null;
				this.uxChuongTrinhId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInChuongTrinhIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the ChuongTrinhId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInChuongTrinhIdList
		{
			get { return _allowNewItemInChuongTrinhIdList;}
			set
			{
				this._allowNewItemInChuongTrinhIdList = value;
				this.uxChuongTrinhId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
				
		private Entities.TList<Entities.LoaiThoiGian> _LoaiThoiGianIdList;
		
		/// <summary>
		/// The ComboBox associated with the LoaiThoiGianId property.
		/// </summary>
		[System.ComponentModel.Category("ComboBox BindingSources")]
		public Entities.TList<Entities.LoaiThoiGian> LoaiThoiGianIdList
		{
			get {return _LoaiThoiGianIdList;}
			set 
			{
				this._LoaiThoiGianIdList = value;
				this.uxLoaiThoiGianId.DataSource = null;
				this.uxLoaiThoiGianId.DataSource = value;
			}
		}
		
		private bool _allowNewItemInLoaiThoiGianIdList;
		
		/// <summary>
		/// Indicates if the ComboBox associated with the LoaiThoiGianId property allow user to add item.
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInLoaiThoiGianIdList
		{
			get { return _allowNewItemInLoaiThoiGianIdList;}
			set
			{
				this._allowNewItemInLoaiThoiGianIdList = value;
				this.uxLoaiThoiGianId.DropDownStyle = value ? System.Windows.Forms.ComboBoxStyle.DropDown : System.Windows.Forms.ComboBoxStyle.DropDownList;
			}
		}
		
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	}
}
